]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Use separate error when disk writes are locked down
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 25 Jan 2021 11:38:51 +0000 (12:38 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 28 Jan 2021 21:47:50 +0000 (21:47 +0000)
The most likely reason for rejecting a screenshot request is that
there's an ongoing operation from the same sender. Still, we shouldn't
assume that that is the case and return an appropriate error when
writing to disk is disabled via lockdown settings.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3618

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1589>

js/ui/screenshot.js

index 787e60f9af964104493940b021ebf035ecd945a5..29cf7c8977e64266fa079c609d492a9c43153777 100644 (file)
@@ -36,11 +36,16 @@ var ScreenshotService = class {
             lockedDown = this._lockdownSettings.get_boolean('disable-save-to-disk');
 
         let sender = invocation.get_sender();
-        if (this._screenShooter.has(sender) || lockedDown) {
+        if (this._screenShooter.has(sender)) {
             invocation.return_error_literal(
                 Gio.IOErrorEnum, Gio.IOErrorEnum.BUSY,
                 'There is an ongoing operation for this sender');
             return null;
+        } else if (lockedDown) {
+            invocation.return_error_literal(
+                Gio.IOErrorEnum, Gio.IOErrorEnum.PERMISSION_DENIED,
+                'Saving to disk is disabled');
+            return null;
         }
 
         let shooter = new Shell.Screenshot();